package com.jt.config;

import com.jt.demo.Person;
import com.jt.demo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component   //标识配置类
@ComponentScan("com.jt")
public class SpringConfig {

    @Bean
//    @Scope("singleton")      //默认值  单例模式
    @Scope("prototype")    //多例模式
//    @Lazy                   //默认条件下都是是立即加载
    //主要测试对象中的无参构造什么时候执行
    public User user(){

        return new User();
    }

}
